package com.ihelp.rest.utils;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ihelp.rest.mis.platform.service.UserService;
import com.ihelp.rest.mis.pojo.SysUser;

public class SystemUserListener implements ServletContextListener{
	
	private static final Logger LOG = LoggerFactory.getLogger(SystemUserListener.class);
	
	public void contextDestroyed(ServletContextEvent sce) {
		
	}

	public void contextInitialized(ServletContextEvent sce) {
		UserService service = SpringContextUtil.getBean(UserService.class);
		SysUser sys = service.findSystemUser();
		if(sys == null){
			LOG.debug("*****初始化系统超级用户*****");
			service.saveSystemUser();
		}
		else{
			LOG.debug("*****系统超级用户正常*****");
		}
	}

	

	

	

}
